﻿#pragma once
#include "afxdialogex.h"
#include "XmlPara.h"
#include "CParaViewTree.h"
#include "CParaListEditCtrl.h"
// CDialogXmlViewer 对话框

//定义动态的craft族的按键，最大9个
#define ID_FILTER_RADIO_CRAFT_0 10050
#define ID_FILTER_RADIO_CRAFT_1 10051
#define ID_FILTER_RADIO_CRAFT_2 10052
#define ID_FILTER_RADIO_CRAFT_3 10053
#define ID_FILTER_RADIO_CRAFT_4 10054
#define ID_FILTER_RADIO_CRAFT_5 10055
#define ID_FILTER_RADIO_CRAFT_6 10056
#define ID_FILTER_RADIO_CRAFT_7 10057
#define ID_FILTER_RADIO_CRAFT_8 10058
#define ID_FILTER_RADIO_CRAFT_9 10059
#define ID_FILTER_RADIO_CRAFT_10 10060

//定义动态的PARAGROUP族的按键，最大9个
#define ID_FILTER_RADIO_PARAGROUP_0 20050
#define ID_FILTER_RADIO_PARAGROUP_1 20051
#define ID_FILTER_RADIO_PARAGROUP_2 20052
#define ID_FILTER_RADIO_PARAGROUP_3 20053
#define ID_FILTER_RADIO_PARAGROUP_4 20054
#define ID_FILTER_RADIO_PARAGROUP_5 20055
#define ID_FILTER_RADIO_PARAGROUP_6 20056
#define ID_FILTER_RADIO_PARAGROUP_7 20057
#define ID_FILTER_RADIO_PARAGROUP_8 20058
#define ID_FILTER_RADIO_PARAGROUP_9 20059
#define ID_FILTER_RADIO_PARAGROUP_10 20060
enum DATA_EQUAL
{
	UNKNOW = -1,
	EQUAL = 0,
	DIFF
};
class CDialogXmlViewer : public CDialogEx
{
	DECLARE_DYNAMIC(CDialogXmlViewer)

public:
	CDialogXmlViewer(CWnd* pParent = nullptr);   // 标准构造函数
	CDialogXmlViewer(CWnd* pParent, cXmlParaDoc* vXmlRecordA, cXmlParaDoc* vXmlRecordB, vector<string>* vLoadList);
	virtual ~CDialogXmlViewer();
public:
	// 显示xml对比结果列表视图
	//CListEditCtrl m_XmlViewList;
// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_DIALOG_XMLVIEWER };
#endif
public:
	virtual BOOL OnInitDialog();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
private:
	void ShowDataCraft();
	void ShowDataParaCraftGroup(HTREEITEM Grades, cXmlParaCraft* craft_A, cXmlParaCraft* craft_B);
private:
	cXmlParaCraft* QueryA_ByName(string name);
	cXmlParaCraft* QueryB_ByName(string name);
	void InsertCraftByName(string name);
	int LoadCraftList(int flag);
private:
	cXmlParaDoc *m_vXmlRecordA;
	cXmlParaDoc *m_vXmlRecordB;
	CParaViewTree m_XmlTree;
	CParaListEditCtrl m_XmlValueList;
	vector<string>* m_vLoadList;
public:
	afx_msg void OnBnClickedButtonExpand();
	afx_msg void OnBnClickedButtonCollapse();
	afx_msg void OnBnClickedButtonSavea();
	afx_msg void OnBnClickedButtonSaveb();
	afx_msg void OnBnClickedButtonLoadA();
	afx_msg void OnBnClickedButtonLoadB();
	afx_msg void OnBnClickedButtonUnloadA();
	afx_msg void OnBnClickedButtonUnloadB();
	afx_msg void OnBnClickedButtonSelcraft();
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	afx_msg void OnBnClickedCheckImportantcraft();
	CButton m_CheckImportantCraft;
};
